﻿using DAL.Model;
using DAL.Model.Local;
using PagedList;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Web.ViewModel
{
    public class HotelList
    {
        public HotelList(HotelsResult result, int page, int take)
        {
            var hotels = new List<Hotel>();
            foreach (var item in result.Hotels)
                hotels.Add(AutoMapper.Mapper.DynamicMap<HotelShortModel, Hotel>(item));

            List = new StaticPagedList<Hotel>(hotels, page, take, result.TotalCount);
            CurrentPage = page;
            TotalPage = result.TotalCount / take;
        }
        public int TotalPage { get; set; }
        public int CurrentPage { get; set; }
        public IPagedList<Hotel> List { get; set; }

    }
}